﻿@using Apps.Web.Core;
@using Apps.Web;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@{
    ViewBag.Title = "化验收样信息";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";
    List<permModel> perm = null;
}
<div class="mvctool">
    <input id="txtTestCode" type="text" class="condition-testcode" placeholder="化验编号" />
    <input id="txtcollectID" type="text" class="condition-testcode" placeholder="收样编号" />
    <input id="txtsampleCode" type="text" class="condition-testcode" placeholder="试样编号" />
    <input id="txtmakeCode" type="text" class="condition-testcode" placeholder="制样编码" />
    <input id="txtbatchCode" type="text" class="condition-testcode" placeholder="批次编号" />
    <input id="txtStartDate" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'txtEndDate\')}' })" type="text" class="condition-date" placeholder="收样时间起" />
    <input id="txtEndDate" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'txtStartDate\')}' })" type="text" class="condition-date" placeholder="收样时间止" />
    @Html.ToolButton("btnQuery", "fa fa-search", Resource.Query, ref perm, "Query", true)
</div>
<table id="List"></table>
@Html.Partial("~/Views/Shared/_Partial_AutoGrid.cshtml")

<div id="modalwindow" class="easyui-window" style="width:800px; height:400px;" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
<script type="text/javascript">
    @Html.Raw(GridHelper.GridFormatterFunc<SampleType>("gConvertSampleType"))

    $(function () {
        $('#List').datagrid({
            url: '@Url.Action("GetList")',
            width:SetGridWidthSub(10),
            methord: 'post',
            height: SetGridHeightSub(45),
            fitColumns: true,
            sortName: 'BATCH_CODE',
            sortOrder: 'desc',
            idField: 'BATCH_CODE',
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true, //奇偶行是否区分
            singleSelect: true,//单选模式
            rownumbers: true,//行号
            columns: [[
                { field: 'BATCH_CODE', title: '批次编码', width: 80, sortable: true },
                { field: 'MAKE_CODE', title: '制样编码', width: 80, sortable: true },
                { field: 'TEST_CODE', title: '化验编码', width: 80, sortable: true },
                { field: 'SAMPLE_CODE', title: '试样编码', width: 80, sortable: true },
                { field: 'SAMPLE_TYPE', title: '样品类型', width: 80, sortable: true, formatter: gConvertSampleType },
                { field: 'COLLECTION_ID', title: '收样编码', width: 80, sortable: true },
                { field: 'WEIGHT', title: '样品重量(G)', width: 80, sortable: true, hidden: true },
                { field: 'SEND_USER_NAME', title: '送样人', width: 80, sortable: true,hidden:true },
                { field: 'COLLECT_USER_NAME', title: '收样人', width: 80, sortable: true },
                { field: 'COLLECT_TIME', title: '收样时间', width: 80, sortable: true },
            ]]
        });
    });
    //ifram 返回
    function frameReturnByClose() {
        $("#modalwindow").window('close');
    }
    function frameReturnByReload(flag) {
        if (flag)
            $("#List").datagrid('load');
        else
            $("#List").datagrid('reload');
    }
    function frameReturnByMes(mes) {
        $.messageBox5s(Lang.Tip, mes);
    }
    $(function () {
        $("#btnQuery").click(function () {
            $("#List").datagrid("load", {
                testCode: $("#txtTestCode").val(),
                startDate: $("#txtStartDate").val(),
                endDate: $("#txtEndDate").val(),
                collectID: $("#txtcollectID").val(),
                sampleCode: $("#txtsampleCode").val(),
                makeCode: $("#txtmakeCode").val(),
                batchCode: $("#txtbatchCode").val(),
            });

        });
    });
</script>
